<?php

class Application_Acl_Assert_MessageCreator
    implements Zend_Acl_Assert_Interface
{
    public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null,
                           Zend_Acl_Resource_Interface $resource = null,
                           $privilege = null)
   {
       if (!$role instanceof Application_Auth_User) {
           throw new Zend_Acl_Exception('Role must be an instance of Application_Auth_User');
       }

       if (!$resource instanceof Application_Model_DbRow_Message) {
           throw new Zend_Acl_Exception('Resource must be an instance of Application_Model_DbRow_Message');
       }

       return $resource->isCreatedBy($role);
   }

}